#pragma once

#include "types.hpp"

namespace zuck
{
	template<typename T>
	class __list_node {
	public:
		using value_type      = T;
		using pointer	      = T*;
		using const_pointer   = const T*;
        using reference       = T&;
        using difference_type = zuck::ptrdiff_t;
		using size_type       = zuck::size_t;
	private:
		using _Data_ptr = T*;
		using _Node_ptr = __list_node<T>*;
	public:
		_Node_ptr _m_p;
		_Node_ptr _m_n;
		_Data_ptr _m_data;
	public:
		explicit __list_node(pointer data, _Node_ptr _Prew, _Node_ptr _Next)
			: _m_data(data), _m_p(_Next), _m_n(_Prew) {}
		
		inline ~__list_node()
		{
			_m_data = null;
			_m_p	= null;
			_m_n	= null;
		}

	public:
		[[nodiscard]] static inline _Node_ptr _Allocate(pointer data, _Node_ptr prev, _Node_ptr next)
        { return new __list_node<T>(data, prev, next); }

		static inline void _Deallocate(_Node_ptr _ptr)
        {
			if (_ptr) {
				delete _ptr;
			}
		}

	public:
		__list_node(const __list_node&) = delete;
		__list_node(__list_node&&)		= delete;

		__list_node& operator=(const __list_node&) = delete;
		__list_node& operator=(__list_node&&)      = delete;
	};
}

